package cn.edu.imau.zy.exam.controller;

import java.util.List;
import java.util.Arrays;


import cn.edu.imau.zy.common.core.entity.examination.EPaperQuestionInfo;
import cn.edu.imau.zy.exam.service.IEPaperQuestionInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.edu.imau.zy.common.annotation.LoginUser;
import cn.edu.imau.zy.common.core.entity.system.SysUser;

import cn.edu.imau.zy.common.core.domain.R;
import cn.edu.imau.zy.common.core.controller.BaseController;

/**
 * 试卷试题关联 提供者
 * 
 * @author gj
 * @date 2021-12-04
 */
@RestController
@RequestMapping("exam/paperQuestionInfo")
public class EPaperQuestionInfoController extends BaseController
{
	
	@Autowired
	private IEPaperQuestionInfoService ePaperQuestionInfoService;
	
	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{id}")
	public EPaperQuestionInfo get(@PathVariable("id") Long id)
	{
		return ePaperQuestionInfoService.getById(id);
		
	}
	
	/**
	 * 查询试卷试题关联列表
	 */
	@GetMapping("list")
	public R list(EPaperQuestionInfo ePaperQuestionInfo)
	{
		startPage();
        return result(ePaperQuestionInfoService.queryList(ePaperQuestionInfo));
	}
	
	
	/**
	 * 新增保存试卷试题关联
	 */
	@PostMapping("save")
	public R addSave(@RequestBody EPaperQuestionInfo ePaperQuestionInfo,@LoginUser SysUser user)
	{
		return toAjax(ePaperQuestionInfoService.save(ePaperQuestionInfo));
	}

	/**
	 * 修改保存试卷试题关联
	 */
	@PostMapping("update")
	public R editSave(@RequestBody EPaperQuestionInfo ePaperQuestionInfo,@LoginUser SysUser user)
	{
		return toAjax(ePaperQuestionInfoService.updateById(ePaperQuestionInfo));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(ePaperQuestionInfoService.removeById(ids));
	}
	
}
